﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace cz.muni.fi.pb138
{
    public partial class AddEditActorCast : Form
    {
        private ListBox.ObjectCollection collection;

        public AddEditActorCast(ListBox.ObjectCollection c)
        {
            InitializeComponent();
            collection = c;
        }

		/// <summary>
		/// Adds actors into the <c>ObjectCollection</c>. The actors are taken from the <c>textBox1</c>
		/// as a string where each actor is separated from the other by comma or a semicolon
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string[] temp = textBox1.Text.Split(',', ';');
            collection.AddRange(temp);
            this.Close();
        }

		/// <summary>
		/// a cancel button. No special action is performed, only the dialog is closed
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
